package com.yeban.base.day04;

import java.util.Arrays;

/**
 * @Desc TODO
 * @Author yeban
 * @Date 2025/9/29
 */
public class ArratDemo {

    public static void main(String[] args) {

        int[] arr = { 10, 9, 8, 7, 6, 5, 4, 3, 2, 1 };
        System.out.println("原数组为：" + Arrays.toString(arr));
        System.out.println("原数组的长度为：" + arr.length);

        System.out.println("----------copyOf----------");
        // copyOf的使用
        int[] arr1 = Arrays.copyOf(arr, arr.length);
        int[] arr2 = Arrays.copyOf(arr, arr.length * 3 / 2 + 1);

        System.out.println("copyOf后的数组为：" + Arrays.toString(arr1));
        System.out.println("拷贝后的数组长度为：" + arr1.length);

        System.out.println("copyOf后的数组为：" + Arrays.toString(arr2));
        System.out.println("拷贝并扩容后的数组长度为：" + arr2.length);


        System.out.println("----------1----------");
        

    }
}
